import { CompletionItem, CompletionItemKind } from 'vscode';
import { ModelItem } from './interface';

/**
 * 适应项
 *
 * @author chitanda
 * @date 2022-01-10 18:01:07
 * @export
 * @class ModelCompletionItem
 * @implements {CompletionItem}
 */
export class ModelCompletionItem extends CompletionItem {
  /**
   * Creates an instance of ModelCompletionItem.
   *
   * @author chitanda
   * @date 2022-01-10 18:01:26
   * @param {string} text 属性名称
   */
  constructor(key: string, modelItem: ModelItem) {
    super({ label: key, description: modelItem.desc });
    switch (modelItem.type) {
      case 'object':
        this.kind = CompletionItemKind.Class;
        break;
      case 'array':
        this.kind = CompletionItemKind.Class;
        break;
      default:
        this.kind = CompletionItemKind.Field;
    }
  }
}
